package cn.mxlshy.springcloud.config;

import lombok.Data;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: 马晓亮
 * @date: 2020/8/11 16:42
 * @description:
 */
@Configuration
public class GatewayConfig {

    @Bean
    public RouteLocator customRouteLocator(RouteLocatorBuilder routeLocatorBuilder) {
        RouteLocatorBuilder.Builder builder = routeLocatorBuilder.routes();
        builder.route("path_route_mxlshy", r -> r.path("/guonei").uri("http://news.baidu.com/guonei")).build();
        return builder.build();
    }
}
